package com.lagou.edu.utils;

import com.alibaba.druid.util.StringUtils;

/**
 * @author jiumoxiaozhi
 * @date 2021/6/20 4:05 下午
 * @description
 */
public class AnnotationUtils {


    /**
     * 处理别名问题
     * @param aClass 类的反射
     * @return beanId
     */
    public static String resolveBeanId(Class<?> aClass) {
        String name = "";
        if (aClass == null)
            return name;
        name = aClass.getName();
        if (!StringUtils.isEmpty(name)){
            char[] chars = name.substring(name.lastIndexOf(".") + 1).toCharArray();
            chars[0] = Character.toLowerCase(chars[0]);
            name = String.valueOf(chars);
        }
        return name;
    }

    /**
     * 处理别名问题
     * @param className 类名
     * @return beanId
     */
    public static String resolveBeanId(String className) {
        String name = "";
        if (!StringUtils.isEmpty(className)){
            char[] chars = className.toCharArray();
            chars[0] = Character.toLowerCase(chars[0]);
            name = String.valueOf(chars);
        }
        return name;
    }
}
